Conversation
- Handle click of matrix room url pattern
| }); | ||
|
|
||
| test( | ||
| group( |
gtalha07
left a comment
There was a problem hiding this comment.
Great and useful changes overall, there's one change I'd like to have prior to merging!!
gnunicorn
left a comment
There was a problem hiding this comment.
There is another format missing, and while I can ignore the questionable way to create the via-param, we need to have support for linking to spaces, too!
| var roomIdWithServer = '$roomId:$server'; | ||
|
|
||
| //For public groups - Replace encoded '%23' string with # | ||
| if (roomIdWithServer.startsWith('%23')) { | ||
| roomIdWithServer = roomIdWithServer.replaceAll('%23', '#'); | ||
| } |
There was a problem hiding this comment.
I think you just want to use the URI class and its decoder functions here ... there could be more than just the starting character being encoded...
| tiles: [ | ||
| SettingsTile( | ||
| onPressed: (ctx) { | ||
| final serverName = roomId.split(':').last; |
There was a problem hiding this comment.
This isn't really how via is meant to work. See the matrix URI spec for details. But ideally via tells you about (additional) servers that we know to be in the room as alternative ways to connect to the room (in particular if the homeserver isn't available). Just repeating the homeserver is a bit of a short-cut that doesn't in practice actually help doing the right resolution.
We can keep this for now, but should probably add a helper function on the rust side that compiles the actual correct information including via.
There was a problem hiding this comment.
Ok got it. I will check for matrix specification and do required changes accordingly.
There was a problem hiding this comment.
I have read the documentations, and agree with you that repeating the homeserver doesn't make sense.
I'm adding FIXME comment and once rust side helper function is ready then will change it accordingly.
| final urlRegexp = RegExp( | ||
| r'https://matrix\.to/#/(?<roomId>.+):(?<server>.+)+', | ||
| caseSensitive: false, | ||
| ); |
There was a problem hiding this comment.
matrix:// is also a valid link format: https://spec.matrix.org/v1.9/appendices/#uris
There was a problem hiding this comment.
How can I get link like matrix:// from Acter or Element general?
There was a problem hiding this comment.
I am not sure which clients are sending those at the moment... the element-x iOS maybe?
There was a problem hiding this comment.
@gnunicorn
No, I have check element web and element iOS. Both are sending matrix.to url.
And matrix:// is not a link url,I believe It is url schema which is generally used in deep linking.
There was a problem hiding this comment.
- Is there any platform or way using with I can get
matrix://and test it? - If
matrix://type of url are consider as url schema then still I have to handle condition for it?
There was a problem hiding this comment.
matrix.to is the old, matrix: is the new way of doing it.
@gnunicorn
Sorry but I'm not agree with that.
Not sure but based on the my knowledge matrix:// and matrix.to are different things and have their own purposes.
matrix://is Matrix URI scheme which ideally suitable in deep-linking for direct intent callsmatrix.tois Matrix Navigation URL and widely used by all the matrix platforms but general navigations.
For better clarification, I'm looking for any platform which is using matrix:// (Matrix URI Scheme definition).
If you have any idea about such matrix platforms then can you please share it so that I can look into the same and get detail understanding.
And if you don't mind then can we proceed with this PR as this PR is mainly for copying RoomID URL from profile page and user should able to handle it with click on that message like element and other platforms doing because matrix:// is different thing and don't have any use-case at least in Acter App.
There was a problem hiding this comment.
are different things and have their own purposes.
That is a misunderstanding though. Quoting the spec, about the matrix.to it says: "This namespacing existed prior to a matrix: scheme." hinting to the fact that they do the same but the existence of both is just an historically artifact to stay backwards compatible when matrix: was added: Both are used for deep-linking (clicking the matrix.to-link on a smartphone with element on it, you will see it come up), and targeting the same objects. From a purpose perspective they do and are the same. With matrix: (no double // after the :by the way) being the one for the future and matrix.to being the fallback.
Thus if want to only use one, we should do the matrix:-format and not the old one but we are only using the legacy with this PR. If you don't want to implement this now, let's open a ticket saying we need matrix:-protocol-support.
There was a problem hiding this comment.
Thanks @gnunicorn for details understanding.
If matrix:// is the new way then for navigating and deep-link then I would like to integrate that way in Acter and have support for both.
@gnunicorn Do you have idea of any of the matrix platform which is using this new way? I just wanted to confirm certain use-cases with that.
There was a problem hiding this comment.
Do you have idea of any of the matrix platform which is using this new way? I just wanted to confirm certain use-cases with that.
as said, if Element-X isn't using it, I wouldn't know if any does. According to the original spec proposal fluffychat and nheko have support for it (don't know if they post use it primarily though).
FYI, when I say the "new way" of doing it ... the Spec was merged 2021 .... and looks like even Element doesn't use it primarily yet, so ....
There was a problem hiding this comment.
Aha, I see..
Let me create create new ticket for "matrix:-protocol-support" and then we can move on with current matrix.to support.
| String parsedString = simplifyBody(widget.message.text); | ||
| final urlRegexp = RegExp( | ||
| r'https://matrix\.to/#/@[A-Za-z0-9\-]+:[A-Za-z0-9\-]+\.[A-Za-z0-9\-]+', | ||
| r'https://matrix\.to/#/[@!#][A-Za-z0-9\-]+:[A-Za-z0-9\-]+\.[A-Za-z0-9\-]+', |
There was a problem hiding this comment.
matrix:// is also a valid link we need to check for https://spec.matrix.org/v1.9/appendices/#uris
| } | ||
| } | ||
|
|
||
| void askToJoinGroup( |
There was a problem hiding this comment.
this should probably become a system-wide route as there are more complex scenarios we need to match, where we might a) need to knock first or load data from remotely before we even know ...
There was a problem hiding this comment.
Understood, let me move this function to chat_utils
| final chat = await ref.read(chatProvider(roomId).future); | ||
| if (!context.mounted) return; | ||
| if (chat.isJoined()) { | ||
| // Navigate to chat room | ||
| context.goNamed( | ||
| Routes.chatroom.name, | ||
| pathParameters: {'roomId': chat.getRoomIdStr()}, | ||
| ); | ||
| } else { | ||
| askToJoinGroup(context, ref, roomId); | ||
| } | ||
| } catch (e) { | ||
| askToJoinGroup(context, ref, roomId); | ||
| } |
There was a problem hiding this comment.
What if the link is for a space? Then we don't properly route there?
| }); | ||
|
|
||
| test( | ||
| group( |
- Used URI class for better management of the urls - Separated some code for making then reusable
This PR fixes issue no - #1097.
Feature Reference Video:
https://github.com/acterglobal/a3/assets/51526480/009763cf-6034-43fe-8552-b33bc64656a8
Unit-test Reference Video:
https://github.com/acterglobal/a3/assets/51526480/c791f224-dcbe-4d24-856c-d51c97f68f8d